﻿@using Tool.Utils
<MudAlert Severity="Severity.Success">@_tableIndex</MudAlert>

@code {
    private string _tableIndex = string.Empty;

    [Parameter]
    public string UserCode { get; set; } = string.Empty;

    [Parameter]
    public int TableCount { get; set; } = 128;

    public override async Task SetParametersAsync(ParameterView parameters)
    {
        await base.SetParametersAsync(parameters);

        if (parameters.TryGetValue<string>("UserCode", out var userCode))
        {
            if(parameters.TryGetValue<int>("TableCount", out var tableCount))
            {
                _tableIndex = TableHelper.GetTableNameNew(string.Empty, userCode, tableCount);
            }
            else
            {
                _tableIndex = TableHelper.GetTableNameNew(string.Empty, userCode);
            }
        }
    }
}
